package com.tj.template.application.trade.input;

import com.fqgj.common.api.ParamsObject;
import com.fqgj.common.utils.StringUtils;
import com.tj.bo.common.conf.util.ParamsValidateUtil;
import com.tj.bo.trade.client.enums.TradeTypeEnum;

/**
 * @program: binary-option
 * @description
 * @author: binary
 * @create: 2020-06-15 15:59
 **/
public class MarketDataRequest extends ParamsObject {

    /**
     * 交易类型
     */
    private Integer tradeType;
    /**
     * 图表X时间轴
     */
    private Integer chartTime;
    /**
     * 产品code
     */
    private String productCode;

    private Integer nodeNum=90;

    public Integer getNodeNum() {
        return nodeNum;
    }

    public MarketDataRequest setNodeNum(Integer nodeNum) {
        this.nodeNum = nodeNum;
        return this;
    }

    public Integer getChartTime() {
        return chartTime;
    }

    public MarketDataRequest setChartTime(Integer chartTime) {
        this.chartTime = chartTime;
        return this;
    }

    public String getProductCode() {
        return productCode;
    }

    public MarketDataRequest setProductCode(String productCode) {
        this.productCode = productCode;
        return this;
    }

    public Integer getTradeType() {
        return tradeType;
    }

    public MarketDataRequest setTradeType(Integer tradeType) {
        this.tradeType = tradeType;
        return this;
    }



    @Override
    public void validate() {
        ParamsValidateUtil.checkParams(TradeTypeEnum.getEnumByCode(tradeType) == null, "tradeType is invalid");
        ParamsValidateUtil.checkParams(chartTime == null || chartTime < 0 || chartTime > 3600, "chartTime is invalid");
        ParamsValidateUtil.checkParams(StringUtils.isEmpty(productCode), "productCode can not be empty");
    }
}
